package top.chengdongqing.mishop.repositories

import org.springframework.data.jpa.repository.JpaRepository
import top.chengdongqing.mishop.entities.CartItem

interface CartRepository : JpaRepository<CartItem, Int> {

    fun findAllByUserId(userId: Int): List<CartItem>

    fun findAllByUserIdAndIsCheckedTrue(userId: Int): List<CartItem>

    fun findBySkuIdAndUserId(skuId: Int, userId: Int): CartItem?

    fun deleteAllByIdInAndUserId(ids: List<Int>, userId: Int): Int

    fun deleteAllByUserIdAndIsCheckedTrue(userId: Int): Int

    fun deleteAllByUserId(userId: Int)
}